/**
 *  @file: PageManager.h
 *  @author: nwz
 *  @brief: 
 *  @date: 2024年8月6日
 * 
 */

#pragma once
#include <basic_header.h>

namespace task {

enum PageId : uint8_t {
	Empty = 0,
	Home,
	About,
	Set,
	Menu,
	Power,
	Charg,
	Compass,
	DateTimeSet,
	Env,
	HR,
	LOffTimeSet,
	TOffTimeSet,
	Timer
};

/*
 *
 */
class PageManager {
public:
	PageManager();
	virtual ~PageManager();

	void init();

	void popBack();

	void load(PageId id);

	void popUntilHome();

	PageId getCurrentPage();

	int getPageSize() {
		return page_top;
	}

	PageId getCurrenPage();

	void onKeyEvent(void *event);

private:
	PageId pop();
	void push(PageId id);
	uint8_t page_top = 0;
	static constexpr uint8_t MAX_SIZE = PAGE_STACK_MAX_SIZE;;
	PageId stack[MAX_SIZE];

	void notifyPageChange();

	void loadDetail(PageId id,lv_scr_load_anim_t anim,uint32_t time);
};

} /* namespace task */
